﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminCP/AdminTemplate.Master" AutoEventWireup="true" CodeBehind="EditAdvertisement.aspx.cs" Inherits="RealtorsPortal.AdminCP.EditAdvertisement" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h1>EDIT ADVERTISEMENTS</h1>
    ______________________________________________________________________________________________
    <fieldset>
        <legend>Advertisement information</legend>
        <div class="input_field">
            <label>
                Service package:
            </label>
            <asp:TextBox ID="txtPackages" runat="server" Width="215px">
            </asp:TextBox>
        </div>
        <div class="input_field">
            <label>
                Type of adv:
            </label>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:RadioButton ID="rdbSell" runat="server" CssClass="radio" GroupName="type" Checked="True" />
            Sell &nbsp;
            <asp:RadioButton ID="rdbRent" runat="server" CssClass="radio" GroupName="type" />
            Rent &nbsp;
            <asp:RadioButton ID="rdbBuy" runat="server" CssClass="radio" GroupName="type" />
            Buy
        </div>
        <div class="input_field">
            <label>
                Category:
            </label>
            <asp:TextBox ID="txtCategory" runat="server" Width="215px">
            </asp:TextBox>
        </div>
        <div class="input_field">
            <label>
                Country:
            </label>
            <asp:TextBox ID="txtCountry" runat="server" Width="215px"></asp:TextBox>
        </div>
        <div class="input_field">
            <label>
                Region:
            </label>
            <asp:TextBox ID="txtRegion" runat="server" Width="215px"></asp:TextBox>
        </div>
        <div class="input_field">
            <label>
                City:
            </label>
            <asp:TextBox ID="txtCity" runat="server" Width="215px"></asp:TextBox>
        </div>
        <div class="input_field">
            <label>
                District:
            </label>
            <asp:TextBox ID="txtDistrict" runat="server" Width="215px"></asp:TextBox>
        </div>
        <div class="input_field">
            <label>
                Title:
            </label>
            <asp:TextBox ID="txtTitle" runat="server" Width="300px"></asp:TextBox>
            &nbsp;&nbsp;
            <asp:RequiredFieldValidator ID="rfv" runat="server"
                CssClass="validate_error"
                ToolTip="Title"
                ForeColor=""
                ControlToValidate="txtTitle" />
        </div>
        <div class="input_field">
            <label>
                Address:
            </label>
            <asp:TextBox ID="txtAddress" runat="server" Width="300px"></asp:TextBox>
            &nbsp;&nbsp;
                <asp:RequiredFieldValidator ID="rfv8" runat="server" ControlToValidate="txtAddress"
                    CssClass="validate_error"
                    ToolTip="Title"
                    ForeColor="" />
        </div>
        <div class="input_field">
            <label>
                Price:
            </label>
            <asp:TextBox ID="txtPrice" runat="server" Width="50px"></asp:TextBox>$ <span class="field_desc">USD dollar</span>
            <asp:RequiredFieldValidator ID="rev7" runat="server" ControlToValidate="txtPrice"
                CssClass="validate_error"
                ToolTip="Area can not be blank"
                ForeColor="" />
            <asp:RegularExpressionValidator ID="rev8" runat="server" ControlToValidate="txtPrice"
                ValidationExpression="^\d*[0-9](|.\d*[0-9])?$"
                CssClass="validate_error"
                ToolTip="Incorrect Format"
                ForeColor=""
                ErrorMessage="Incorrect Format" />
        </div>
        <div class="input_field">
            <label>
                Area(m2):
            </label>
            <asp:TextBox ID="txtArea" runat="server" Width="50px"></asp:TextBox>
            &nbsp;&nbsp;
                <asp:RequiredFieldValidator ID="rfv1" runat="server" ControlToValidate="txtArea"
                    CssClass="validate_error"
                    ToolTip="Area can not be blank"
                    ForeColor="" />
            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtArea"
                ValidationExpression="^\d*[0-9](|.\d*[0-9])?$"
                CssClass="validate_error"
                ToolTip="Incorrect Format"
                ForeColor=""
                ErrorMessage="Incorrect Format" />
        </div>
        <div class="input_field" id="floor" runat="server">
            <label>
                Floor:
            </label>
            <asp:TextBox ID="txtFloor" runat="server" Width="50px"></asp:TextBox>
            &nbsp;&nbsp;                
        <asp:RegularExpressionValidator ID="rev3" runat="server" ControlToValidate="txtFloor"
            ValidationExpression="^\d+$"
            CssClass="validate_error"
            ToolTip="Floor can not be blank!"
            ForeColor=""
            ErrorMessage="Incorrect Format" />
            &nbsp;&nbsp;&nbsp;&nbsp;Built year:
            <asp:TextBox ID="txtBuildYear" runat="server" Width="50px"></asp:TextBox>
            &nbsp;&nbsp;                
        <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtBuildYear"
            ValidationExpression="^[1-9][0-9][0-9][0-9]$"
            CssClass="validate_error"
            ToolTip="Incorrect Format"
            ForeColor=""
            ErrorMessage="Incorrect Format" />
        </div>
        <div class="input_field" id="BathAndBedroom" runat="server">
            <label>
                Bath room:
            </label>
            <asp:TextBox ID="txtBathRoom" runat="server" Width="50px"></asp:TextBox>
            &nbsp;&nbsp;
        <asp:RegularExpressionValidator ID="rev4" runat="server" ControlToValidate="txtBathRoom"
            ValidationExpression="^(^\d+$)|^(^\d+$)"
            CssClass="validate_error"
            ToolTip="Incorrect Format"
            ForeColor=""
            ErrorMessage="Incorrect Format"></asp:RegularExpressionValidator>
            &nbsp;&nbsp; Bed room:
            <asp:TextBox ID="txtBedRoom" runat="server" Width="50px"></asp:TextBox>
            &nbsp;&nbsp;                
        <asp:RegularExpressionValidator ID="rev5" runat="server" ControlToValidate="txtBedRoom"
            ValidationExpression="^(^\d+$)|^(^\d+$)"
            CssClass="validate_error"
            ToolTip="Title"
            ForeColor=""
            ErrorMessage="Incorrect Format" />
        </div>
        <div class="input_field" id="Amenity" runat="server">
            <label>
                Amenities:
            </label>
            <asp:TextBox ID="txtAmenity" runat="server" Width="300px"></asp:TextBox>
            &nbsp;&nbsp;
        </div>
        <div class="input_field">
            <table>
                <tr>
                    <td>
                        <label style="line-height: 6;">
                            Description:
                        </label>
                    </td>
                    <td>
                        <asp:TextBox ID="txtDescription" runat="server" TextMode="MultiLine" Width="326px" Height="50px"
                            Style="clear: none;"></asp:TextBox>
                        <label style="line-height: 6;">
                            <asp:RequiredFieldValidator ID="rfv5" runat="server" ControlToValidate="txtDescription"
                                CssClass="validate_error"
                                ToolTip="Title"
                                ForeColor="" /></label>
                    </td>
                </tr>
            </table>
        </div>
        <div class="input_field">
            <label>
                Main Picture:
            </label>
            <asp:FileUpload ID="SingleUpload" runat="server" Width="300px" />
            <span class="field_desc"></span>&nbsp;
            <asp:Label ID="lblMess" runat="server"></asp:Label>
        </div>
        <div class="input_field">
            <label>
                Other Picture:
            </label>
            <asp:FileUpload ID="MultiUpload" runat="server" Width="300px" accept="gif|jpg" maxlength="3" multiple="true" />
            <span class="field_desc"></span>
            <div class="input_field">
                <asp:Label ID="lblFileList" runat="server"></asp:Label>
            </div>
            <div class="input_field">
                <asp:Label ID="lblUploadStatus" runat="server"></asp:Label>
            </div>
            <div class="input_field">
                <asp:Label ID="lblFailedStatus" runat="server"></asp:Label>
            </div>
        </div>
        <div class="input_field no_margin_bottom">
            <label>
                &nbsp;</label>
            <asp:Button ID="btnUpdate" runat="server" Text="UPDATE" CssClass="submit" OnClick="btnUpdate_Click" />
            <asp:Button ID="btnReturn" runat="server" Text="RETURN" CssClass="submit" OnClick="btnReturn_Click" />
        </div>
    </fieldset>
    <div id="overlay" runat="server" class="web_dialog_overlay">
    </div>

    <div id="dialog" runat="server" class="web_dialog">
        <asp:DropDownList ID="ddlCountry" runat="server" Width="100%" AutoPostBack="true" OnSelectedIndexChanged="ddlCountry_SelectedIndexChanged"></asp:DropDownList>
    </div>
    <div id="RegionDialog" runat="server" class="web_dialog">
        <asp:DropDownList ID="ddlRegion" runat="server" Width="100%" AutoPostBack="true" OnSelectedIndexChanged="ddlRegion_SelectedIndexChanged">
        </asp:DropDownList>
    </div>
    <div id="CityDialog" runat="server" class="web_dialog">
        <asp:DropDownList ID="ddlCity" runat="server" Width="100%" AutoPostBack="true" OnSelectedIndexChanged="ddlCity_SelectedIndexChanged">
        </asp:DropDownList>
    </div>
    <div id="DistrictDialog" runat="server" class="web_dialog">
        <asp:DropDownList ID="ddlDistrict" runat="server" Width="100%" AutoPostBack="true" OnSelectedIndexChanged="ddlDistrict_SelectedIndexChanged">
        </asp:DropDownList>
    </div>
    <div id="CategoryDialog" runat="server" class="web_dialog">
        <asp:DropDownList ID="ddlCategory" runat="server" Width="100%" AutoPostBack="true" OnSelectedIndexChanged="ddlCategory_SelectedIndexChanged"></asp:DropDownList>
    </div>
    <div id="PackageDialog" runat="server" class="web_dialog">
        <asp:DropDownList ID="ddlPackages" runat="server" Width="100%" AutoPostBack="true" OnSelectedIndexChanged="ddlPackages_SelectedIndexChanged"></asp:DropDownList>
    </div>
    <style type="text/css">
        .web_dialog_overlay {
            position: fixed;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            height: 100%;
            width: 100%;
            margin: 0;
            padding: 0;
            background: #000000;
            opacity: .15;
            filter: alpha(opacity=15);
            -moz-opacity: .15;
            z-index: 101;
            display: none;
        }

        .web_dialog {
            display: none;
            position: fixed;
            width: 350px;
            height: 30px;
            top: 50%;
            left: 40%;
            margin-left: -190px;
            margin-top: -100px;
            /*background-color: #ffffff;
            border: 2px solid #336699;*/
            padding: 0px;
            z-index: 102;
            font-family: Verdana;
            font-size: 10pt;
        }

        .web_dialog_title {
            border-bottom: solid 2px #336699;
            background-color: #336699;
            padding: 4px;
            color: White;
            font-weight: bold;
        }

            .web_dialog_title a {
                color: White;
                text-decoration: none;
            }

        .align_right {
            text-align: right;
        }
    </style>
    <script language="javascript" type="text/javascript">

        $(document).ready(function () {
            $("#<%=txtCountry.ClientID%>").click(function () {
                ShowDialog(false);
            });
            $("#<%=txtCategory.ClientID%>").click(function () {
                ShowCategoryDialog(false);
            });
            $("#<%=txtRegion.ClientID%>").click(function () {
                ShowRegionDialog(false);
            });
            $("#<%=txtCity.ClientID%>").click(function () {
                ShowCityDialog(false);
            });
            $("#<%=txtDistrict.ClientID%>").click(function () {
                ShowDistrictDialog(false);
            });
            $("#<%=txtPackages.ClientID%>").click(function () {
                ShowPackagesDialog(false);
            });
        });

        function ShowPackagesDialog(modal) {
            $("#<%=overlay.ClientID%>").show();
            $("#<%=PackageDialog.ClientID%>").fadeIn(700);

            if (modal) {
                $("#<%=overlay.ClientID%>").unbind("click");
            }
            else {
                $("#<%=overlay.ClientID%>").click(function (e) {
                    HidePackagesDialog();
                });
            }
        }
        function HidePackagesDialog() {
            $("#<%=overlay.ClientID%>").hide();
            $("#<%=PackageDialog.ClientID%>").fadeOut(300);
        }

        function ShowDistrictDialog(modal) {
            $("#<%=overlay.ClientID%>").show();
            $("#<%=DistrictDialog.ClientID%>").fadeIn(700);

            if (modal) {
                $("#<%=overlay.ClientID%>").unbind("click");
            }
            else {
                $("#<%=overlay.ClientID%>").click(function (e) {
                    HideDistrictDialog();
                });
            }
        }
        function HideDistrictDialog() {
            $("#<%=overlay.ClientID%>").hide();
            $("#<%=DistrictDialog.ClientID%>").fadeOut(300);
        }

        function ShowCityDialog(modal) {
            $("#<%=overlay.ClientID%>").show();
            $("#<%=CityDialog.ClientID%>").fadeIn(700);

            if (modal) {
                $("#<%=overlay.ClientID%>").unbind("click");
            }
            else {
                $("#<%=overlay.ClientID%>").click(function (e) {
                    HideCityDialog();
                });
            }
        }
        function HideCityDialog() {
            $("#<%=overlay.ClientID%>").hide();
            $("#<%=CityDialog.ClientID%>").fadeOut(300);
        }

        function ShowRegionDialog(modal) {
            $("#<%=overlay.ClientID%>").show();
            $("#<%=RegionDialog.ClientID%>").fadeIn(700);

            if (modal) {
                $("#<%=overlay.ClientID%>").unbind("click");
            }
            else {
                $("#<%=overlay.ClientID%>").click(function (e) {
                    HideRegionDialog();
                });
            }
        }
        function HideRegionDialog() {
            $("#<%=overlay.ClientID%>").hide();
            $("#<%=RegionDialog.ClientID%>").fadeOut(300);
        }

        function ShowCategoryDialog(modal) {
            $("#<%=overlay.ClientID%>").show();
            $("#<%=CategoryDialog.ClientID%>").fadeIn(700);

            if (modal) {
                $("#<%=overlay.ClientID%>").unbind("click");
            }
            else {
                $("#<%=overlay.ClientID%>").click(function (e) {
                    HideCategoryDialog();
                });
            }
        }
        function HideCategoryDialog() {
            $("#<%=overlay.ClientID%>").hide();
            $("#<%=CategoryDialog.ClientID%>").fadeOut(300);
        }


        function ShowDialog(modal) {
            $("#<%=overlay.ClientID%>").show();
            $("#<%=dialog.ClientID%>").fadeIn(700);

            if (modal) {
                $("#<%=overlay.ClientID%>").unbind("click");
            }
            else {
                $("#<%=overlay.ClientID%>").click(function (e) {
                    HideDialog();
                });
            }
        }
        function HideDialog() {
            $("#<%=overlay.ClientID%>").hide();
            $("#<%=dialog.ClientID%>").fadeOut(300);
        }
    </script>
</asp:Content>
